const mongoose = require('./db');



const friendSchema = new mongoose.Schema({
    photo: String,
    name: String,
    address: String,
    lovenum: Number,
    logs: Array,
    files: Array,
    date: Date,
    content: String,
    uid: String,
})

const Friend = mongoose.model('Friend', friendSchema, 'Friend');

const UserSchema = new mongoose.Schema({
    name: String,
    telephone: Number,
    fid: String,
    password: String,
})

// 创建一个跑步记录表
const RunSchema = new mongoose.Schema({
    title: String,//当前记录名
    distance: String,//距离
    duration: String,//时长
    date: String,//日期
})

// 创建一个坐标表
const CoordinateSchema = new mongoose.Schema({
    lng: Number,
    lat: Number,
    //设置外键
    run: {
        type: mongoose.Types.ObjectId,
        ref: 'Run'
    }
})

const Run = mongoose.model('Run', RunSchema, 'Run');
const Coordinate = mongoose.model('Coordinate', CoordinateSchema, 'Coordinate');

const User = mongoose.model('User', UserSchema, 'User');

module.exports = {
    User,
    Run,
    Coordinate,
    Friend
}